参考https://zhuanlan.zhihu.com/p/258394849 
 
mkdir test/riscv64-linux -p 
mkdir /opt/riscv64 
cd test/riscv64-linux 
git clone https://gitee.com/mirrors/riscv-gnu-toolchain 
cd riscv-gnu-toolchain 
git rm qemu 
git submodule update --init --recursive 
echo $? 
./configure --prefix=/opt/riscv64 2>&1 | tee log_config 
echo $? 
sudo make linux 2>&1 | tee log_build 
echo $? 
export PATH="$PATH:/opt/riscv64/bin" 



riscv64-unknown-linux-gnu-gcc -v

which riscv64-unknown-linux-gnu-gcc 

riscv64-unknown-linux-gnu-gcc -Q --help=target

图示(截图来自<<程序员的自我修养—链接、装载与库>>):



https://gitcode.net/mirrors/riscv/riscv-gnu-toolchain/-/tree/master/linux-headers
